﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Services;
using Meqs.Entity;
using System.Web.UI.MobileControls;
using System.Collections.Generic;
using Meqs.Logic.Interface;

public partial class Credit_Teacher_RuleSettings_SetQuality : System.Web.UI.Page
{
    protected IList<ExamSubjecySchool2> subj = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

        }
    }
    [WebMethod]
    public static int[] SaveUsersSets(StuCauseLevel[] levels, int[] deleteids)
    {
        List<int> tempids = new List<int>();
        SchoolInfo si = SchoolCommon.Sch_SchoolInfo;
        foreach (StuCauseLevel k in levels)
        {
            k.SchoolYear = si.SchoolYear;
            k.Term = si.SchoolTerm;
            k.SchoolMark = si.SchoolMark;
            if (k.RID == -1)
            {
                int i = Container<Meqs.Logic.Interface.IStuCauseLevelLogic>.Instance.Create(k);
                tempids.Add(i);
            }
            else
            {
                Container<Meqs.Logic.Interface.IStuCauseLevelLogic>.Instance.Update(k);
                tempids.Add(k.RID);
            }
        }
        Hashtable ht = null;
        foreach (int i in deleteids)
        {
            ht = new Hashtable();
            ht.Add("SchoolMark", CommonScore.GetSchoolMark);
            ht.Add("RID", i);
            Container<Meqs.Logic.Interface.IStuCauseLevelLogic>.Instance.DeleteById(ht);
        }

        int[] ids = new int[tempids.Count];
        for (int i = 0; i < tempids.Count; i++)
        {
            ids[i] = tempids[i];
        }
        return ids;
    }
    protected void btnBind_Click(object sender, EventArgs e)
    {


        Hashtable ht = new Hashtable();
        SchoolInfo si = SchoolCommon.Sch_SchoolInfo;
        ht.Add("SchoolMark", si.SchoolMark);
        ht.Add("SchoolYear", si.SchoolYear);
        ht.Add("Term", si.SchoolTerm);
        IList<StuCauseLevel> newList = Container<IStuCauseLevelLogic>.Instance.FindAll(ht);
        Repeater1.DataSource = newList;
        Repeater1.DataBind();


    }

   
}
